import { createRouter, createWebHashHistory } from "vue-router";
import NotFound from '../components/404.vue'
import Register from '../views/Register.vue'
import UserInfo from '../views/UserInfo.vue'
import Login from '../components/Login.vue'

// 创建路由实例
const router = createRouter({
    // 模式有两种：createWebHashHistory()--路径中含有#，createWebHistory()
    history: createWebHashHistory(),
    // 将每个路由映射到对应的组件
    routes: [
        {
            path: '/:paths(.*)*',
            component: NotFound
        },
        {
            path: '/',
            redirect: '/login'
        },
        {
            path: '/login',
            component: Login
        },
        {
            path:'/register',
            name:'register',
            component:Register
        },
        {
            path:'/userInfo',
            name:'userInfo',
            component:UserInfo
        }
    ]
});

export default router